//
//  JKSegementController.h
//  JKTest2
//
//  Created by 王冲 on 2019/4/28.
//  Copyright © 2019 JK科技有限公司. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, JKSegementStyle) {
    JKSegementStyleDefault,    /**< 指示杆和按钮的标题齐平*/
    JKSegementStyleFlush,      /**< 指示杆和按钮宽度齐平*/
};

@interface JKSegementController : UIViewController

@property (nonatomic, strong) UIColor *segementTintColor;   /**< 选中时的字体颜色，默认黑色*/
@property (nonatomic, strong) NSArray *viewControllers;
@property (nonatomic, strong) UIScrollView *segementView;
@property (nonatomic, assign) JKSegementStyle style;

+ (instancetype)segementControllerWithFrame:(CGRect)frame titles:(NSArray <NSString *>*)titles;
- (instancetype)initWithFrame:(CGRect)frame titles:(NSArray *)titles;
- (void)setSegementViewControllers:(NSArray <UIViewController *>*)viewControllers;
/**
 返回当前被选中的item的下标
 */
- (NSInteger)selectedAtIndex;
- (void)selectedAtIndex:(void(^)(NSInteger index))indexBlock;
/**
 手动指定选中的item
 */
- (void)setSelectedItemAtIndex:(NSInteger)index;

-(void)updateTittle:(NSArray *)titlesArray;

@end

NS_ASSUME_NONNULL_END
